package paskal.abstractplayer;

import java.util.List;

public class Playlist {

	private List<VkTrack> playlist = null;
	
	public List<VkTrack> getPlaylist() {
		return playlist;
	}

	private int cursor = 0;

	public Playlist(List<VkTrack> playlist) {
		this.playlist = playlist;
	}

	public void next() {
		cursor++;
		if (cursor >= playlist.size())
			cursor = 0;
	}

	public void previous() {
		cursor--;
		if (cursor < 0)
			cursor = playlist.size() - 1;
	}

	public VkTrack get() {
		return playlist.get(cursor);
	}
	
	public VkTrack get(int index) {
		cursor = index;
		return playlist.get(cursor);
	}

	public int getCursor() {
		return cursor;
	}
}
